
<select name ="destination_tree_id" id="destination_tree_id" class="<?= $resort_menu_class ?>" > 
  <!--  <option value="">-- Choice a resort --</option>         -->
</select>   

   <script type="text/javascript">
		$(function(){                          
			$('#destination_tree_master_id').change(function(){
                              managerEnableChild();                        
                        })
                })

          
          $(document).ready(function(){	
               managerEnableChild();
          });
          

          function getDestinationsChild(id){
              if (id){
                   <?php 
                       $http = ($_SERVER['SERVER_PORT'] == '80') ? 'http' : 'https';                       
                       $host = $_SERVER['HTTP_HOST'];  
                       $url  = $http . '://' . $host . "/get_destination_child.php";
                   ?>                       
                  $.getJSON('<?php echo $url ?>', {parent_id: id, ajax: 'true'}, function(results){
                                var options;
                                
			 	for (var i = 0; i < results.length; i++) {
				       options += '<option value="' + results[i].tree_id +' " ' + selected(results[i].tree_id) +  '>' 
                                           + results[i].name + '</option>';
				}
                                if (! options)
                                        options = '<option value="">-- Choice a resort --</option>';	
			        $('#destination_tree_id').html(options).show();
				$('.loading').hide();
 			});        
               } else {
                    $('#destination_tree_id').html('<option value="">– Choice a resort –</option>');
               }
          }
          
          function selected (value){
              var valueSelected = 
                  <?php 
                           if($hotel_search_form_values['destination_tree_id'])
                               echo $hotel_search_form_values['destination_tree_id'];
                           else echo "''";
                  ?>;
              if (value == valueSelected)  {
                  return 'selected="selected" ';
              } else return '';
          }
          
          
          function managerEnableChild(){
                  $('#destination_tree_id').prop('disabled', true);
                        getDestinationsChild($('#destination_tree_master_id').val());
                        if ($('#destination_tree_master_id').val() > 0)
                               $('#destination_tree_id').prop('disabled', false);
                    else $('#destination_tree_id').prop('disabled', true);  
          }
   </script>
   